// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router';
import IndexVue from '@/views/index.vue';
import PostDetail from '@/views/community/detail.vue'
import ProgrammerDetail from '@/views/programmer/detail.vue'


const routes = [
  {
    path: '/',
    name: 'Index',
    component: IndexVue,
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login.vue'),
  },
  {
    path: '/programmer',
    name: 'programmer',
    component: () => import('@/views/programmer.vue'),
  },
  {
    path: '/task',
    name: 'task',
    component: () => import('@/views/task.vue'),
  },
  {
    path: '/community',
    name: 'Community',
    component: () => import('@/views/community.vue'),
  },
  {
    path: '/community',
    children: [
      { path: '/community/post', component: () => import('@/views/community/post.vue') },
    ]
  },
  {
    path: '/requirement',
    name: 'requirement',
    component: () => import('@/views/requirement.vue'),
  },
  {
    path: '/call',
    name: 'Call',
    component: () => import('@/views/user/call.vue'),
  },
  {
    path:'/user',
    children:[
      {path:'/user/call',component:()=>import('@/views/user/call.vue')}
    ]
  },
  {
    path: '/userInfo',
    name: 'userInfo',
    component: () => import('@/views/userInfo.vue'),
  },
  {
    path: '/userInfo',
    //子路由
    children: [
      { path: '/userInfo/message', component: () => import('@/views/userInfo/message.vue') },
      { path: '/userInfo/task', component: () => import('@/views/userInfo/task.vue') },
      { path: '/userInfo/favorite', component: () => import('@/views/userInfo/favorite.vue') },
      { path: '/userInfo/list', component: () => import('@/views/userInfo/list.vue') },
    ]
  },
  {
    path: '/community/detail/:id',
    name: 'PostDetail',
    component: PostDetail
  },
  {
    path: '/programmer/detail/:id',
    name: 'ProgrammerDetail',
    component: ProgrammerDetail
  },
  {
    path: '/task/detail/:id',
    name: 'TaskDetail',
    component: () => import('@/views/task/detail.vue'),
    meta: {
      title: '任务详情'
    }
  },
  {
    path: '/communication',
    name: 'Communication',
    component: () => import('@/views/communication.vue')
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes: routes
});

export default router;